package com.luozhili.io;

import com.luozhili.io.base.IoDemoBase;

import java.io.*;

public class FilterDemo extends IoDemoBase {


    public  void output(){

        try {
            FileOutputStream out = new FileOutputStream("file.txt");
            BufferedOutputStream bout = new BufferedOutputStream(out);//加入缓冲区，提高io效率，之后的操作让缓冲区来代理
            bout.write(new String("abc 123 123").getBytes());
            bout.close();
        }catch (IOException e){

        }

    }

    public void input(){
        try {
            FileInputStream input = new FileInputStream("file.txt");
            BufferedInputStream binput = new BufferedInputStream(input);
            int read = binput.read();
            while (binput.available() >0) {
                System.out.println(binput.read());
            }
            binput.close();
        }catch (IOException e){

        }


    }
}
